package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.Setmeal;
import com.sky.entity.ShoppingCart;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishItemVO;
import com.sky.vo.SetmealVO;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ShoppingCartMapper {
    /*
    * 查询数据库是否有该物品
    * */

    List<ShoppingCart> selectShopping(ShoppingCart shoppingCart);
/*
    修改数量
* */
    @Update("update shopping_cart set number=#{number} where id =#{id}")
    void updateNUmberByid(ShoppingCart shoppingCart);
/*
* 添加物品
* */
    @Insert("insert into shopping_cart(name, image, user_id, dish_id, setmeal_id, dish_flavor, amount, create_time) VALUES " +
            "(#{name},#{image},#{userId},#{dishId},#{setmealId},#{dishFlavor},#{amount},#{createTime})")
    void add(ShoppingCart shoppingCart);
/*
* 查询购物车
* */
    @Select("select * from shopping_cart where user_id =#{userId}")
    List<ShoppingCart> liseId(ShoppingCart shoppingCart);
/*
* 清空购物车
* */
    @Delete("delete  from shopping_cart where user_id=#{userId}")
    void cleanShopping(ShoppingCart shoppingCart);
/*
* 根据id删除购物车商品
* */
    @Delete("delete from shopping_cart where id=#{id}")
    void subshopping(ShoppingCart shoppingCart);
}
